

import { useRouter as useNextRouter, usePathname } from "next/navigation";

// 统一处理路由前缀
export const useRouter = () => {
    const router = useNextRouter();
    // 获取当前路径
    const currentPath = usePathname(); // 使用 usePathname 获取当前路径
    const chat_id = currentPath.split("/").filter(Boolean).pop()?.split("?")[0];
    // console.log('chat_id', currentPath)
    return {
        ...router,
        currentPath,
        chat_id,
    };
};


